<template>
	<div class="task-cont">
		<ul>
			<li v-for="(item,index) in taskList">
				<p>{{item.taskName}}</p>
				<ul class="hideUl">
					<li v-for="obj in item.data" class="clearFix"><span :class="[{isComplete:obj.completeState=='0'},'status']">{{obj.completeState=='0'?'完成':'过期'}}</span>
						<strong>{{obj.taskName}}<span v-if="obj.pointObject"> ({{obj.pointObject}})</span></strong><span class="endTime">截止至：{{obj.endTime}}</span>
					</li>
				</ul>
			</li>
		</ul>
        <div class="no_data" v-if="noData">
        	<i class="ion ion-ios-paper-outline"></i>
        	<p>暂无数据</p>
    	</div>
    	<loading v-if="loadShow"></loading>
	</div>
	
</template>
<script type="text/javascript">
	import SafeStyle from '../../assets/css/task.scss'

	import safeUrl from '../../assets/js/insterface'

	import getQuery from '../../assets/js/get_querys'

	import http from '../../assets/js/http_mixin'	

	import global from '../../assets/js/global'	

	export default{
		data(){ 
			return{
				tipMessage:'',
				taskList:[],
				empNo:'',
				urlName:'',
				noData:false,
				loadShow:true
			}
		},
		mixins:[getQuery,http],
		mounted(){
			document.title="历史任务";
			this.$el.parentElement.parentNode.style.background = '#F6F6F6';
			var query = this.getQuerys();
      		this.empNo = query.empNo;
			this.getData();
		},
		methods:{
			getData() {
				var vue = this;
				var param = {
					empNum: this.empNo
				}
				this.getInfo({
					url:safeUrl.historyTask,
					param:param,
					success(data) {
						console.log(data)
						vue.loadShow = false;
						if(data.data.resultCode == "1"){
							vue.taskList = data.data.resultData;
						}else{
							vue.noData = true;
						}
						console.log(vue.taskList)						
					},
					fail(){
						this.$vux.toast.show({
							text: '服务器错误',
							type:'text'
						})
					}
				})
			}
		}
	}

</script>
<style lang="scss" scoped>
	.task-cont{
		.hideUl{
			display:block;
			.isComplete{
				color: #80d880 !important;
			}
			.endTime{
				float:right;
			}
			.status{
				color:#f77272;
				float:left;
				width:13%;
			}
		}		
	}
</style>